import { ref } from 'vue'

export default function () {
  const scrollTop = ref(0)

  document.addEventListener('scroll', () => {
    scrollTop.value =
      document.documentElement.scrollTop || document.body.scrollTop //获取滚动距离
  })

  return {
    scrollTop
  }
}
